<template>
    <div class="pay-message">
        <p class="pay-title">支付信息</p>
        <div class="pay-cell">
            <span class="title">时长：</span>
            <span class="content"><span class="point">{{ formateSeconds(params.allSeconds) || '--' }}</span>分钟</span>
        </div>
        <div class="pay-cell">
            <span class="title">单价：</span>
            <span class="content"><span class="point">{{ params.unitPrice }}</span>币/分钟</span>
        </div>
        <div class="pay-cell">
            <span class="title">应付：</span>
            <span class="content"><span class="point">{{ params.allPrice || '--' }}</span>币</span>
        </div>
        <div class="pay-cell">
            <span class="title">实付：</span>
            <span class="content"><span class="point">{{ params.realPrice || '--' }}</span>币</span>
        </div>
    </div>
</template>
<script>
import { computed } from 'vue';

export default {
    name: 'PayMessage',
    props: {
        params: {
            type: Object,
            default: () => {
                return {}
            }
        }
    },
    setup(props) {
        const formateSeconds = computed((item) => {
            return item => {
                return Math.ceil(item / 60)
            }
        })
        return {
            formateSeconds
        }
    }
}
</script>
<style lang="scss" scoped>
.pay-message{
    width: 200px;
    background: white;
    box-shadow: 0 0 5px 0px #e8e4e4;
    padding: 10px;
    border-radius: 3px;
    transition: all 0.5s;

    &:hover {
        box-shadow: 0 0 5px 0px #cac6c6;
    }
    .pay-cell{
        padding-bottom: 10px;
        display: flex;
        align-items: center;
        font-size: 12px;
        color: var(--el-text-regulary);
        .title{
            padding-right: 10px;
            color: var(--el-text-color-regular);
        }
        &:last-child{
            padding-bottom: 0;
        }
        .point{
            color: var(--el-color-danger);
        }
    }
    .pay-title{
        padding-bottom: 10px;
        text-align: center;
    }
}
</style>